/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aptech.JavaXML.DOMValidator;

import java.util.List;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 *
 * @author thanhtq
 */
public class Survey {


    private String idSurvey;
    private String contentSurvey;
    private String commenSurvey;
    private String name;
    private List<String> questionId;

    public Survey() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getQuestionId() {
        return questionId;
    }

    public void setQuestionId(List<String> questionId) {
        this.questionId = questionId;
    }

    

    public String getCommenSurvey() {
        return commenSurvey;
    }

    public void setCommenSurvey(String commenSurvey) {
        this.commenSurvey = commenSurvey;
    }

    public String getContentSurvey() {
        return contentSurvey;
    }

    public void setContentSurvey(String contentSurvey) {
        this.contentSurvey = contentSurvey;
    }

    public String getIdSurvey() {
        return idSurvey;
    }

    public void setIdSurvey(String idSurvey) {
        this.idSurvey = idSurvey;
    }




    public void createBookElement(Document doc) throws Exception{
        try{
            Element categoryElement = doc.createElement("category");
            categoryElement.setAttribute("id", idSurvey);
            Element contentElement = doc.createElement("content");
            contentElement.setTextContent(contentSurvey);
            Element commentElement = doc.createElement("comment");
            commentElement.setTextContent(commenSurvey);
            categoryElement.appendChild(contentElement);
            categoryElement.appendChild(commentElement);

            doc.getDocumentElement().appendChild(categoryElement);
        }
        catch(Exception ex){
            throw ex;
        }
    }

    @Override
    public String toString() {
        return contentSurvey;
    }



}
